package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.entity.Setmeal;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishItemVO;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealMapper {

    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    @Select("select count(*) from setmeal where category_id = #{categoryId}")
    Long countByCategoryId(Long id);

    // 分页查询
    List<SetmealVO> list(SetmealPageQueryDTO setmealPageQueryDTO);

    //新增套餐
    @AutoFill(OperationType.INSERT)
    void insert(Setmeal setmeal);

    Long countStatus(List<Long> ids);

    void deleteByid(List<Long> ids);

    Setmeal selectById(Long id);

    @AutoFill(OperationType.UPDATE)
    void update(Setmeal setmeal);

    void updateStatus(Setmeal setmeal);

    List<Dish> getBySetmealId(Long id);

    List<Setmeal> listByCategoryId(Setmeal setmeal);

    List<DishItemVO> selectListDish(Long id);
}
